Conversation
…ds which aren't needed
5dd5607 to
c8d84f7
Compare
9447393 to
c90f89d
Compare
|
@copilot review |
|
@mjewildnhs I've opened a new pull request, #34, to work on those changes. Once the pull request is ready, I'll request review from you. |
lambdas/client-transform-filter-lambda/src/services/validators/event-validator.ts
Show resolved
Hide resolved
| /** | ||
| * Add persistent context that will be included in all subsequent log entries | ||
| */ | ||
| addContext(context: LogContext): void { |
There was a problem hiding this comment.
Are we going to include things like COMPONENT in log context like core does?
| const correlationId = extractCorrelationId(rawEvent); | ||
| logger.addContext({ correlationId }); | ||
|
|
||
| logLifecycleEvent("received", { |
There was a problem hiding this comment.
Is it worth "received" and any other events being strongly typed? We could have it so the TypeScript typings apply to the full payload so we can't pass invalid keys for a given event.
|
|
||
| // Emit metric for event received | ||
| await metricsService.emitEventReceived( | ||
| eventType ?? "unknown", |
There was a problem hiding this comment.
Rather than having to ?? "unknown" everywhere, it might make sense for the metrics service to do this for us by allowing the property to be undefined and filling it in with the defaults if missing.
| await metricsService.emitDeliveryInitiated(clientId || "unknown"); | ||
|
|
||
| // Clear context for next event | ||
| logger.clearContext(); |
There was a problem hiding this comment.
Is there ever a chance of the handler being invoked multiple times in succession in the same NodeJS runtime? Considering we're using async / await everywhere, this could lead to the context being cleared before one request fully finishes, as different parts of the code will resume in a non-deterministic order.
We may instead want to have unique elements of the logging context always be passed around in log calls to avoid this situation.
| }); | ||
| await metricsService.emitTransformationFailure( | ||
| eventErrorType, | ||
| "TransformationError", |
There was a problem hiding this comment.
I think these also might benefit from strong typing
| functions: 100, | ||
| lines: 100, | ||
| statements: -10, | ||
| branches: 50, |
There was a problem hiding this comment.
Are these thresholds intentional for all work going forwards?
84de504 to
fd433af
Compare
c412701 to
6287115
Compare
This reverts commit 6287115.
…operties. Set env/namespace props in terraform
rhyscoxnhs
left a comment
There was a problem hiding this comment.
No real fundamental issues here. I've left some minor suggestions for improvements, but there's no need to block a merge for these.
There was a problem hiding this comment.
The comments added to this file seem fairly redundant, maybe we can strip these out?
| variable "deploy_mock_webhook" { | ||
| type = bool | ||
| description = "Flag to deploy mock webhook lambda for integration testing (test/dev environments only)" | ||
| default = true # CCM-14200: Temporary test value, revert to false |
There was a problem hiding this comment.
Do we need to revert this to false now?
| notifyData.supplierStatus.toLowerCase() as ClientSupplierStatus; | ||
|
|
||
| const attributes: ChannelStatusAttributes = { | ||
| messageId: notifyData.messageId, |
There was a problem hiding this comment.
This can just be messageId, since it's destructured above
| ); | ||
|
|
||
| const attributes: MessageStatusAttributes = { | ||
| messageId: notifyData.messageId, |
There was a problem hiding this comment.
Same as the other one - this can just be messageId,
| level: process.env.LOG_LEVEL || "info", | ||
| }); | ||
|
|
||
| function isValidCallbackPayload(payload: unknown): payload is CallbackPayload { |
There was a problem hiding this comment.
This might be easier to understand as a zod schema, it's a bit hard to parse as it is right now
…to use but its more complex
Description
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.